<!-- 订单账单表表单弹窗 -->
<form id="orderbill-form" lay-filter="orderbill-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">关联订单</label>
        <div class="layui-input-block">
            <input name="orderId"  type="text" class="layui-input" maxlength="20"  id="orderId"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">会员名称</label>
        <div class="layui-input-block">
            <input name="memberId" placeholder="请输入会员ID" type="text" class="layui-input layui-hide" maxlength="20"  id="memberId"
                   lay-verify="required" required/>
            <input name="memberNickname" placeholder="请输入会员ID" type="text" class="layui-input" maxlength="20"  id="memberNickname"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">商家名称</label>
        <div class="layui-input-block">
            <input name="businessId" placeholder="请输入商家ID" type="text" class="layui-input layui-hide" maxlength="20"  id="businessId"
                   lay-verify="required" required/>
            <input name="businessName" type="text" class="layui-input" maxlength="20"  id="businessName"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">交易凭证</label>
        <div class="layui-input-block">
            <input name="transNumber" placeholder="请输入交易单号 付款凭证" type="text" class="layui-input" maxlength="20"  id="transNumber"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">商户单号</label>
        <div class="layui-input-block">
            <input name="businessOrder" placeholder="请输入商户单号" type="text" class="layui-input" maxlength="20"  id="businessOrder"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">支付类型</label>
        <div class="layui-input-block">
            <input name="payType" type="text" class="layui-input layui-hide" maxlength="20"  id="payType"
                   lay-verify="required" required/>
            <input name="strPayType"  type="text" class="layui-input" maxlength="20"  id="strPayType"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">订单总金额</label>
        <div class="layui-input-block">
            <input name="originalPrice" placeholder="请输入订单总金额" type="text" class="layui-input" maxlength="20"  id="originalPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">折扣价格</label>
        <div class="layui-input-block">
            <input name="discountPrice" placeholder="请输入折扣价格" type="text" class="layui-input" maxlength="20"  id="discountPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">券号</label>
        <div class="layui-input-block">
            <input name="couponId" placeholder="请输入券ID" type="text" class="layui-input" maxlength="20"  id="couponId"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">券抵用金额</label>
        <div class="layui-input-block">
            <input name="couponPrice" placeholder="请输入券抵用金额" type="text" class="layui-input" maxlength="20"  id="couponPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">券使用说明</label>
        <div class="layui-input-block">
            <input name="couponDesc" placeholder="请输入券使用说明" type="text" class="layui-input" maxlength="20"  id="couponDesc"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">券消费记录</label>
        <div class="layui-input-block">
            <input name="couponTransNo" placeholder="请输入券消费记录ID" type="text" class="layui-input" maxlength="20"  id="couponTransNo"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">积分消费记录</label>
        <div class="layui-input-block">
            <input name="integralTransNo" placeholder="请输入积分消费记录ID" type="text" class="layui-input" maxlength="20"  id="integralTransNo"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">积分消费数量</label>
        <div class="layui-input-block">
            <input name="integralCount" placeholder="请输入积分消费数量" type="text" class="layui-input" maxlength="20"  id="integralCount"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">积分抵用金额</label>
        <div class="layui-input-block">
            <input name="integralPrice" placeholder="请输入积分抵用金额" type="text" class="layui-input" maxlength="20"  id="integralPrice"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">会员卡号</label>
        <div class="layui-input-block">
            <input name="vipId" placeholder="请输入会员卡ID" type="text" class="layui-input" maxlength="20"  id="vipId"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">会员卡消费记录</label>
        <div class="layui-input-block">
            <input name="vipTransNo" placeholder="请输入会员卡消费记录ID" type="text" class="layui-input" maxlength="20"  id="vipTransNo"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">会员卡抵用金额</label>
        <div class="layui-input-block">
            <input name="vipPrice" placeholder="请输入会员卡抵用金额" type="text" class="layui-input" maxlength="20"  id="vipPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">实付金额</label>
        <div class="layui-input-block">
            <input name="actualPrice" placeholder="请输入实际支付金额" type="text" class="layui-input" maxlength="20"  id="actualPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">支付状态</label>
        <div class="layui-input-block">
            <input name="status"  type="text" class="layui-input layui-hide" maxlength="20"  id="status"
                   lay-verify="required"  required/>
            <input name="strStatus"  type="text" class="layui-input" maxlength="20"  id="strStatus"
                   lay-verify="required"  readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <!--<input name="createDate" placeholder="请输入创建时间" type="text" class="layui-input" maxlength="20"  id="createDate"-->
                   <!--lay-verify="required" required/>-->
            <label class="layui-form-label" style="width: 180px;text-align: left;" name="createDate"  id="createDate"></label>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <!--<button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>-->
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var orderbill = admin.getTempData('t_orderbill');
           if (orderbill.method=="update"){
               if(orderbill.payType==0){
                   orderbill.strPayType = '微信支付';
               }else if(orderbill.payType==1){
                   orderbill.strPayType = '余额支付';
               }else if(orderbill.payType==2){
                   orderbill.strPayType = '佣金支付';
               }else if(orderbill.payType==3){
                   orderbill.strPayType = '赠送余额支付';
               }

               if(orderbill.status==0){
                   orderbill.strStatus='未支付';
               }else if(orderbill.status==1){
                   orderbill.strStatus='已支付';
               }if(orderbill.status==2){
                   orderbill.strStatus='已确认';
               }
               $("#createDate").text(orderbill.createDate);
        	form.val('orderbill-form', orderbill);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('order/orderbill/'+orderbill.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
